<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <link rel="head.png" href="/PNG/head.png"/>
    <title>欢迎使用领捷智慧物流管理系统</title>
    <link rel="hshortcut icon" href="../static/img/own/head.png"/>
    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
    <link rel="stylesheet" href="/static/fonts/fontawesome-all.min.css">
</head>

<body>
    <div id="wrapper">
        <div class="d-flex flex-column" id="content-wrapper">
            <div id="content">
    <div class="container-fluid">
        <div class="card shadow">
            <div class="card-header py-3" style="height: 75px;">
                <div class="row" style="width: auto;height: auto;">
                    <div class="col">
                        <div class="btn-group" role="group">
                            <button class="btn btn-primary" type="button" style="width: 180px;" id="fahuojilu">发货记录</button>
                            <button class="btn btn-primary" type="button" style="margin-left: 5px;width: 180px;" id="ditu">配送地图</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-body">
                <div class="table-responsive table mt-2" id="dataTable-1" role="grid" aria-describedby="dataTable_info">
                    <table class="table my-0" id="dataTable">
                        <thead style="height: 60px;text-align: center">
                            <tr style="height: 60px;">
                                <th style="width: 150px;height: 60px;">订单序号</th>
                                <th style="width: auto;text-align: center;">商品编号</th>
                                <th>商品数量</th>
                                <th>客户名称</th>
                                <th>客户电话</th>
                                <th>客户地址</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="delivery" style="text-align: center">

                        </tbody>
                        <tfoot>
                            <tr></tr>
                        </tfoot>
                    </table>
                </div>
                <div class="row">
                    <div class="col-md-6 align-self-center">
                        <p id="dataTable_info" class="dataTables_info" role="status" aria-live="polite">Showing 1 to 10 of 27</p>
                    </div>
                    <div class="col-md-6">
                        <nav class="d-lg-flex justify-content-lg-end dataTables_paginate paging_simple_numbers">
                            <ul class="pagination">
                                <li class="page-item disabled"><a class="page-link" href="#" aria-label="Previous"><span aria-hidden="true">«</span></a></li>
                                <li class="page-item active"><a class="page-link" href="#">1</a></li>
                                <li class="page-item"><a class="page-link" href="#">2</a></li>
                                <li class="page-item"><a class="page-link" href="#">3</a></li>
                                <li class="page-item"><a class="page-link" href="#" aria-label="Next"><span aria-hidden="true">»</span></a></li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <footer class="bg-white sticky-footer">
        <div class="container my-auto">
            <div class="text-center my-auto copyright"><span>鄂ICP备2021022432号</span></div>
        </div>
    </footer>
    </div><a class="border rounded d-inline scroll-to-top" href="#page-top"><i class="fas fa-angle-up"></i></a></div>
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/bootstrap/js/bootstrap.min.js"></script>
    <script src="/static/js/chart.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
    <script src="/static/js/script.min.js"></script>
    <script src="/static/js/jquery.session.js"></script>
<script>

    $(function (){
        $("#ditu").on("click",function (){
            $(location).attr("href","/page/toDeliveryMap");
        })
    })

    $(function (){
        $("#fahuojilu").on("click",function (){
            $(location).attr("href","/page/toRecordSendGoods");
        })
    })


    // <!--    显示所有待发货-->

    $(document).ready(function (){
        $.ajax({
            url: "/order/allOutputRecord",
            type: 'post',
            dataType:"json",
            success:function (result){
                let str = "";
                for(let i = 0; i < result.length; i++){
                    str +="<tr><td  class=\"checkOrderId\">" + result[i].orderid +"</td>" +
                        "<td>" + result[i].goodsid + "</td>" +
                        "<td>" + result[i].num + "</td>" +
                        "<td>" + result[i].customername + "</td>" +
                        "<td>" + result[i].customerphone + "</td>" +
                        "<td>" + result[i].customeradd + "</td>" +
                        "<td><button class=\"btn btn-primary fahuo\" type=\"button\">发货</button></td></tr>"
                }
                $("#delivery").append(str);
            }
        })
    })


    // 发货操作
    $("#delivery").on("click",".fahuo",function (){
        let index = $(".fahuo").index(this);
        let orderid = $(".checkOrderId").eq(index).text();
        // alert(orderid);
        $(location).attr("href","/delivery/toSendGoods?orderid="+orderid);
    })

    //session
    $.session.set("url",window.location.href);
</script>

</body>

</html>